// 菜品

import request from '@/utils/request'
import R from '@/types/conduit/R'
import { DishPageWrapper, DishSaveParam } from '@/types/param/dish'
import Dish from '@/types/entity/Dish'

export const queryShopDishListPage = (dishPageWrapper: DishPageWrapper): Promise<R<{ total: number; listData: Dish[] }>> =>
  request({
    url: `/shop/dish/queryShopDishListPage`,
    method: 'GET',
    params: dishPageWrapper
  })
export const changeDishStatus = (dishId: number, status: number): Promise<R<null>> =>
  request({
    url: `/shop/dish/changeDishStatus`,
    method: 'POST',
    params: { dishId, status }
  })
export const deleteBatchDishes = (dishIds: number[]): Promise<R<null>> =>
  request({
    url: `/shop/dish/deleteBatchDishes`,
    method: 'POST',
    data: dishIds
  })

export const saveShopDish = (dishSaveParam: DishSaveParam): Promise<R<null>> =>
  request({
    url: `/shop/dish/saveShopDish`,
    method: 'PUT',
    data: dishSaveParam
  })
export const getShopDishInfo = (dishId: number): Promise<R<DishSaveParam>> =>
  request({
    url: `/shop/dish/getShopDishInfo/${dishId}`,
    method: 'GET'
  })
export const changeBetterDisplayStatus = (dishId: number, betterDisplayStatus: number): Promise<R<null>> =>
  request({
    url: `/shop/dish/changeBetterDisplayStatus`,
    method: 'POST',
    params: { dishId, betterDisplayStatus }
  })
